//	AUTHOR:			ENRICO CANTONI
//	CREATED:		SEPTEMBER 12, 2017
//	MODIFIED: 		NOVEMBER 9, 2022
//	DESCRIPTION:	This is the master cleaning file.
//					All cleaning files should be run through this program.
//					To run this file, change the global "root" on line 21
//					to reflect the correct location on the user's machine.
//					"Root" should refer to the directory of the main folder
//					containing the "Code", "Data", and "Output" subfolders.


// Set Stata version
version 16.1

// Clear memory
clear all
set more off

// Set global values
global root C:/Users/canto/Dropbox/vote_family/Replication
do ${root}/Code/globals.do
cd ${root}

// Code files
local code_clean_CPS				"clean_CPS.do"

********************************************************************************
********************************************************************************

// Wipe scratch directory
dir_clear, dir(${data_scratch}) ext(dta)

// Switches: these control which parts of the data cleaning code you will re-run
#delimit ;
local switches_all
	clean_CPS
;
#delimit cr

	/* CPS turnout data	*/	local switch_clean_CPS				= 1

********************************************************************************
********************************************************************************

// Start timer
timer on 1

foreach switch of local switches_all {
	if `switch_`switch'' {
		cd ${code_cleaning}
		do `code_`switch''
	}
}

// End timer
timer off 1
timer list 1
